
{{if .ErrMsg}}
<div class="alert alert-error">
	<button type="button" class="close" data-dismiss="alert">&times;</button>
	<strong>{{.ErrMsg}}</strong>
</div>
{{end}}
<div class="row-fluid">
	<div class="block span12">
		<p class="block-heading">写文章</p>
		<div class="block-body collapse in">
			<form method="POST">
				<div class="control-group"></div>
				<div class="control-group">
						<input type="text" class="span12" name="Title" value="{{.Post.Title}}" placeholder="Input blog title">
				</div>
				<div class="control-group">
						<textarea name="Content" sclass="span12">{{.Post.Content}}</textarea>
				</div>
				<div class="control-group">
						<input type="text" id="inputTag" name="Tags" placeholder="Tags" value="{{.PostTags}}">
				</div>
				<div class="control-group">
						<ul id="selectTags">
							{{range .AllTags}}<li>{{.TagName}}</li>{{end}}
						</ul>
				</div>
				<div class="control-group">
						<input type="submit" class="btn btn-primary" value="发布">
				</div>
			</form>
		</div>
	</div>
</div>

<script type="text/javascript" src="{{.DomainPath}}/static/admin/tinymce/tinymce.min.js"></script>
<script type="text/javascript">
tinymce.init({
	selector: "textarea",
	plugins: [
		"advlist autolink lists link image charmap print preview anchor",
		"searchreplace visualblocks code fullscreen",
		"insertdatetime media table contextmenu paste"
	],
	height: 500,
	toolbar: "insertfile undo redo | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image"
});
</script>
<link href="{{.DomainPath}}/static/admin/tagit/css/jquery-ui.css" rel="stylesheet" type="text/css">
<link href="{{.DomainPath}}/static/admin/tagit/css/jquery.tagit.css" rel="stylesheet" type="text/css">
<link href="{{.DomainPath}}/static/admin/tagit/css/tagit.ui-zendesk.css" rel="stylesheet" type="text/css">
<script src="{{.DomainPath}}/static/admin/tagit/js/jquery-ui.min.js" type="text/javascript" charset="utf-8"></script>
<script src="{{.DomainPath}}/static/admin/tagit/js/tag-it.min.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript">
$(function(){
	var existTags = [];
	{{range .AllTags}}existTags.push({{.TagName}});{{end}}
	$('#inputTag').tagit({
		availableTags: existTags,
		allowSpaces: true
	});
	$('#selectTags').tagit({
		readOnly: true,
		onTagClicked: function(evt, ui) {
			$('#inputTag').tagit('createTag', $('#selectTags').tagit('tagLabel', ui.tag));
		}
	});
});
</script>